	// 结果集
	var appVue = new Vue({
    	el: '#app',
    	data: {
    		items:[],
    		curPage:1,
			totalPages:0,
			totalRecords:0,
			pageRecords:25,
			condition:{
				search_LIKE_groupName:'',
				iDisplayStart:0,
				iDisplayLength:25
			}
    	},
    	methods:{
    		search:function(){
    			this.condition.iDisplayStart = this.start;
            	this.condition.iDisplayLength = this.pageRecords;
            	
            	appVue.binding(pageData.aaData,pageData.iTotalPages,pageData.iTotalRecords);
            	return;
            	
				$.getData({//提交数据
					url:'school/student/contact',//直接写除掉项目名之后的路径
					data:this._data.condition,//获取vue绑定的数据，一定要用_data获取，不要直接提交pageData，否则会导致浏览器
					success:function(res){//服务端返回成功的回调
						if(res.data){
							appVue.binding(res.data.aaData,res.data.iTotalPages,res.data.iTotalRecords);
						}
					},
					error:function(data){//返回错误的调
						
					}
				});
			},
			del:function(item){
				$.post({
					url:'brush/buyer/delete/'+item.id,
					data:{},
					success:function(res){//服务端返回成功的回调
						appVue.search();
					},
					error:function(data){//返回错误的调
						
					}
				});
			},
			reset:function(){
				this.condition.search_LIKE_email='';
				this.condition.search_GTE_inDate='';
				this.condition.search_LTE_inDate='';
			},
			binding:function(data,tp,tr){
        		// 数据绑定
    			this.items = data;
    			this.totalPages = tp;
    			this.totalRecords = tr;
        	},
            btnClick: function(data){
            	// 点击页码
            	if(isNaN(parseInt(data))) return;
                if(data != this.curPage){
                    this.curPage = data
                };
                 this.search();
            },
            firstClick:function(){
            	// 第一页
            	if(this.curPage > 1){
            		this.curPage = 1;
            	};
            	this.search();
            },
            prevClick:function(){
            	// 上一页
            	if(this.curPage > 1){
            		this.curPage--;
            	};
            	this.search();
            },
            nextClick:function(){
            	// 下一页
            	if(this.curPage < this.totalPages){
            		this.curPage++;
            	};
            	this.search();
            },
            lastClick:function(){
            	// 最后一页
            	if(this.curPage != this.totalPages){
            		this.curPage = this.totalPages;
            	}
            },
            submit:function(){
				// 查询提交
            	this.search();
			},
			reset:function(){
				// 重置查询条件
			}
    	},
    	computed: {
        	start:function(){
        		// 开始条数
        		return (this.curPage -1) * this.pageRecords + (this.items.length > 0 ? 1 : 0);
        	},
        	end:function(){
        		// 结束条数
        		return (this.curPage -1) * this.pageRecords + this.items.length;
        	},
        	indexs: function(){
            	// 显示的页码
                var left = 1
                var right = this.totalPages
                var ar = [] 
                if(this.totalPages >= 11){
                  if(this.curPage > 5 && this.curPage < this.totalPages - 4){
                          left = this.curPage - 5
                          right = this.curPage + 4
                  }else{
                      if(this.curPage <= 5){
                          left = 1
                          right = 10
                      }else{
                          right = this.totalPages
                          left = this.totalPages - 9
                      }
                  }
               }
              while (left <= right){
                  ar.push(left)
                  left ++
              }   
              return ar
           },
           disableLast: function(){
        	   // 是否禁用最后页按钮
                if(this.curPage == this.totalPages){
                    return true
                }
                return false
           },
           disableFirst: function(){
        	   // 是否禁用第一页按钮
                if(this.curPage == 1){
                    return true
                }
               return false
           }
    	}
    });    
	
	appVue.search();